package com.my.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Date;

@Data
@Accessors(chain = true)
public class Curriculum {

    @TableId(type = IdType.AUTO)
    private Long id;
    private String name;
    private Integer week;
    private String startTime;
    private String endTime;
    private Long gradeClassId;
    private String remarks;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @TableField(exist = false)
    private String weekName;
    @TableField(exist = false)
    private String cName;
    @TableField(exist = false)
    private Long gId;
    @TableField(exist = false)
    private String gName;

    public String getWeekName(){
        if(week != null) {
            switch (week) {
                case 0: return "周日";
                case 1: return "周一";
                case 2: return "周二";
                case 3: return "周三";
                case 4: return "周四";
                case 5: return "周五";
                case 6: return "周六";
                default: return "";
            }
        }
        return "";
    }

}
